import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        int[] ary = new int[6];
        int max=0;
        int min=0;
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i <ary.length ; i++) {
            ary[i]=scanner.nextInt();
        }
        //write your code here......
        for(int j=0;j<ary.length-1;j++) {
            if(ary[j]>ary[j+1]) {
                max = ary[j];
            }
            if(ary[j]<ary[j+1]) {
                min = ary[j+1];
            }
        }

        System.out.println(max+" "+min);
    }
}